Skip to content

Open a repository or its files in an editor, an agent, Finder or a terminal - #9

Merged
progresshans merged 13 commits into
developfrom
feature/open-in
Nov 30, 2026
Merged

progresshans merged 13 commits into
developfrom
feature/open-in

Conversation

@progresshans

Copy link
Copy Markdown
Owner

Kaern can now open a repository, or a file in it, in an editor, a coding agent, Finder or a terminal. An Open button in the toolbar opens the repository in your editor, and its ▾ lists the other choices. Review's file headers have the same button for a file, which opens at the file's first change. A new Settings tab, Open In, picks the editor and the terminal, leaves items out of the Open menus and adds your own.

Why

  • Getting from Kaern to the code meant a detour. A repository had Show in Finder and Open in Terminal (always Terminal), and nothing for an editor. GitKraken has Open in… with ⌥E, ⌥O and ⌥T.
  • Coding agents start in a repository's folder. Starting one from the repository you're looking at saves finding that folder in a terminal.
  • New agents keep coming, and a list in the code can't keep up. Kaern knows the common ones, and anything else can be added in Settings.

Change

  • The toolbar's Open sits beside Review and Focus. It opens the repository in the default editor and shows that editor's icon, or Finder's when no editor is installed.
    • Its ▾ lists the installed editors (VS Code, Cursor, Zed, Xcode, the JetBrains IDEs…), the agents, Finder, the terminal, Copy Path and Default Editor ▸. It ends with Customize Menu….
    • The File menu, a tab's and the repository list's right-click menus, and Quick Open offer the same choices.
    • ⌥E, ⌥O and ⌥T work as in GitKraken. They're off while text is typed, so ⌥ still types é, ø and †.
    • In a narrow window with names under the icons, Open moves into ».
    • A repository's Show in Finder is now Open in Finder, which opens the folder itself.
  • A file's Open is in Review's header and each All Files header. It opens the file in the editor at its first change (VS Code and its forks by their file links, Xcode with xed), or a picture or a PDF in the app macOS picks. ⌘↓ does the same.
    • Its ▾ adds the agents, with @path put in their prompt but not sent.
    • For a commit's file, the ▾ also has Open Version at , which opens a read-only copy named after the commit.
    • The files' right-click menus have Open in and Open With.
  • Agents (OpenAgents):
    • Claude Code and Codex open in their apps by their links (claude://code/new, and codex://threads/new, which the ChatGPT app opens) or in the terminal.
    • Kiro CLI, Gemini CLI, Cursor Agent and Copilot CLI open in the terminal.
    • An agent shows when its app takes its link or its command is on the login shell's PATH. Kaern asks the shell for that PATH once a launch, in the background (LoginPath).
  • A command in the terminal (TerminalCommands) goes through a .command script handed to Terminal, iTerm or Ghostty, which all run one. The script removes itself, goes to the folder, runs the command in an interactive login shell and leaves you in that shell.
  • Settings › Open In is a new tab. It takes the editor and terminal pickers from General and lists the editors and agents the Open menus show.
    • Untick one to leave it out of the menus. The default editor always stays.
      • adds an app, a command for the terminal, or a link that uses {folder}, {file}, {line} and {prompt}.
    • A double-click or Edit… changes an added item, and −, Delete or Remove takes it away.
    • The list is the system's (List with selection, which is a table underneath). An earlier version gave each row a SwiftUI double-click gesture, and that held every click on the row, the checkbox's too, for about 350 ms.
    • The list is as tall as the screen leaves room for.
    • The settings are stored in KaernOpenHidden and KaernOpenCustom.
  • The Open menus' layout on macOS 27:
    • There's no ✓ column (showsStateColumn), so every row starts 16 pt in and the header's hairline runs where the separators do. The only ✓ is in Default Editor ▸.
    • Notes (Terminal, Claude app, Read-only copy…) follow their titles in small secondary text, as Finder writes "(default)". A note at the row's right end stops short of the shortcuts' column.
    • The app icons ask to be shown (preferredImageVisibility), because macOS 27 hides menu icons otherwise.
  • Debug driver and checks:
    • A test instance opens nothing and notes what it would have opened (opened in the dump).
    • The dump has openIn, which lists the editors, the terminal and the agents.
    • menu, menuItems and menuRun know the Open menus. openInSheet opens the + sheet, and snapshotWindow … sheet takes its picture.
    • A debug frame is now forgotten only by the view that reported it last. A file's Open buttons in Review's header and in All Files share a name, and one of them lost its frame when the other went away.
    • New check t_openin. suite.py's areas and the checks' README are updated to match.
  • CHANGELOG: entries under New.

Checked

  • t_openin passed in light and dark. It checks:

    • the Open buttons and both ▾ menus
    • ⌥O, ⌥T and ⌥E, and ⌥O in the search field, which types ø and opens nothing
    • ⌘↓ and a commit's version
    • each agent's link or command, with the folder, file, line and prompt filled in
    • three added items: a command, a link no app takes, and an app only for files
    • leaving an item out while the default editor stays
    • Customize Menu…
    • pictures of Settings › Open In and its + sheet

    It goes by what the Mac has installed, so it passes on any Mac.

  • The checks for every area the branch touches: 53 of 53. After that, t_openin ran again after each later fix, and t_quickopen once after the read-through fixes.

  • Debug and Release builds compile with no warnings in any file the branch changed.

  • The menus' edges were measured in their pictures.

  • The .command script was run outside a terminal, in a folder whose name has a quote and a space, and it found codex with only a bare PATH.

  • The Settings list's clicks can't be timed in a test instance, because the driver's clicks don't reach a table in a window that isn't in front. They were tried by hand.

  • Not checked: Codex's link in the ChatGPT app (its path parameter isn't documented), and a command in iTerm or Ghostty.

🤖 Generated with Claude Code

progresshans and others added 11 commits November 29, 2026 17:48
…, Finder or a terminal

An Open button in the toolbar, beside Review and Focus, opens the repository in the default editor and shows that
editor's icon (Finder's when none is installed). Its ▾ lists the installed editors (VS Code, Cursor, Zed, Xcode,
the JetBrains IDEs…), Claude Code in the Claude app (claude://code/new) and in a terminal (claude-cli://open),
Finder, the terminal, Copy Path, and which editor the button uses. File › Open in…, the right-click menus of a tab
and of the repository list, and Quick Open have the same, with ⌥E, ⌥O and ⌥T as in GitKraken. The keys are off
while text is typed, so ⌥ still types é, ø and † there.

Review's header and each All Files header have the same kind of button for a file: it opens the file in the editor
at its first change (VS Code and its forks by their file links, Xcode with xed), or a picture or a PDF in the app
macOS picks, and ⌘↓ (File › Open “…”) does the same. Its ▾ adds Claude Code with the file named (@path) and, for a
commit's file, Open Version at <commit>: a read-only copy named after the commit. The files' right-click menus have
Open in <that app> and Open With.

Settings › General picks the editor and the terminal (Terminal, iTerm, Ghostty); Open in Terminal always opened
Terminal before. A repository's Show in Finder is now Open in Finder, which opens the folder itself. From macOS 27 a
menu hides its items' images unless they ask to be shown (preferredImageVisibility), so the app icons ask. With
names under the icons and the window under 1,000 pt, Open goes into » with New Branch, Stash and Pop. A test
instance opens nothing: it notes what it would have opened (OpenIn.debugLog).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… setting

The dump's driver section has what a test instance would have opened (opened), which editors, terminal and Claude
Code handlers the Mac has (openIn), and where the views that report themselves are (frames, from debugFrame).
menu, menuItems and menuRun know openIn and openFile <path>, a menu placed by its right edge, an item named with its
reason ("Claude Code — Terminal") or in a submenu ("Open With > Cursor"); right-click menus know commitFile
<commit> <path>; key … through <typed> and press … through go the whole way a real key goes; openClear forgets
what was opened.

t_openin clicks the toolbar's Open button and Review's, reads both ▾ menus and runs their items, presses ⌥O ⌥T ⌥E
(and ⌥O in the search field, which types ø there and opens nothing) and ⌘↓, opens a commit's version and reads the
copy, and moves the button to another editor in Settings. It goes by what the Mac has installed, so it passes on
any Mac. The checks' README says how a test instance opens nothing.

t_openin, t_narrow760, t_zoom, t_modes, t_settings and t_small passed, with their light and dark pictures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
macOS 27 starts the title of a menu row without an image where the icons are, and Kaern's menu header starts at the
✓ column, so the Open menus had three left edges: the header at 16 pt, Copy Path and Default Editor at 30 pt, the
apps' names at 52 pt. Rows without an app now have a blank 16 pt icon, so their titles start with the apps' names;
the header's text starts there too, and its hairline runs where the separators do (measured in the menu pictures:
52 pt, and 29.5 to 15.5 pt from the edges). The repository menu's ✓ is on Finder when no editor is installed (the
button then opens Finder), so the menu always has its ✓ column and the header stays in line.

t_openin now checks that every row has an icon and that one row has the ✓; it passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c3c4adb lined the Open menus' text up after the ✓ column and a 16 pt icon, 52 pt in, so the header, Copy Path and
Default Editor sat indented under the apps' names. The Open menus now hide their ✓ column (showsStateColumn), and
nothing is indented: the header's text, the apps' icons and the rows without an app start 16 pt in, and the header's
hairline runs where the separators do, 16 pt in from each side (measured in the menu pictures). The one ✓ left is the
default editor's, in Default Editor ▸; ⌥E marks the button's editor, and ⌘↓ the app a file's button opens. A row
without an icon that has a reason at its right (Open Version at… · Read-only copy) has its tab 22 pt further, an icon
and its gap, so the reason ends where the apps' reasons end.

The debug frames lost a view's frame when another view with the same name disappeared after it appeared (a file's Open
button in Review's header and the same file's in All Files): a name is now forgotten only by the view that reported it
last. The driver's menuItems tells whether a menu has a ✓ column.

t_openin checks that the Open menus have no ✓ column and no ✓ outside Default Editor, that Default Editor's ✓ is on
the ⌥E editor and follows the setting, and takes a picture of a commit file's menu; it passed in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ort of the shortcuts

A note at a row's right end (`titled`: a right tab in the title) ends where the menu's titles end, which is where its
shortcuts' column begins. The Open menus have shortcuts (⌥E ⌥O ⌥T, ⌘↓), so their notes (Claude app, Terminal, macOS
default, Read-only copy) stopped well short of the right edge. The notes now follow their titles, in the same small
secondary text (`noted`), the way Finder writes "(default)", and the 22 pt lead c8045c5 gave a row without an icon is
gone. Tried first: the item's badge, which macOS 27 puts at the right edge but draws as a grey pill.

The driver reads both kinds of note from the title (`menuLabel`).

t_openin passed in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd add

The toolbar's ▾, a file's ▾, the files' Open With ▸, File › Open in Agent ▸, Quick Open and a tab's menu list the
agents found on this Mac (OpenAgents): Claude Code and Codex in their apps by their links (claude://code/new;
codex://threads/new, whose `path` the ChatGPT app reads as the new thread's folder since it took Codex in) or in the
terminal, and Kiro CLI, Gemini CLI, Cursor Agent and Copilot CLI in the terminal. One shows when its app takes its
link or its command is on the login shell's PATH, which Kaern asks the shell for once a launch, in the background
(LoginPath). From a file's menu, Claude Code and Codex get "@path" in their prompt, not sent.

A command runs in the chosen terminal through a .command script handed to it (Terminal, iTerm and Ghostty all run
one): the script removes itself, goes to the folder and runs the command in an interactive login shell, then leaves
you in that shell (TerminalCommands). Run outside a terminal, it found codex from a bare PATH, in a folder whose name
has a quote and a space.

Settings › Open In, a new tab, takes the editor and terminal pickers from General and lists what the Open menus show:
untick one to leave it out (never the default editor), and + adds an app, a command for the terminal or a link, with
{folder}, {file}, {line} and {prompt} (KaernOpenHidden, KaernOpenCustom). The toolbar's ▾ ends with Customize Menu…,
which opens it. The debug driver reports the agents, opens the + sheet (openInSheet) and takes a picture of a sheet
(snapshotWindow sheet <title>).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tings › Open In

t_openin goes by the agents this Mac has (each one's link or command) and adds three of its own through
KaernOpenCustom: a command, a link no app takes, and an app only for files. It checks each in a repository's and a
file's menus, with the folder, the file, its line and the prompt filled in; that a left-out agent and editor go while
the default editor stays; that Customize Menu… opens Settings › Open In; and it takes pictures of that tab and its +
sheet. It passed in light and dark, and so did t_quickopen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each row of the list had a double-click gesture (to change an added one), and SwiftUI holds every click such a
gesture covers until it knows no second click is coming: a checkbox in such a row changed 355 ms after the click,
against 2 ms in a row without it (measured with the same rows put in a test instance's main window, whose clicks the
debug driver can send). The double-click is now on an added one's name only, and a single click on the row selects
it: the checkboxes change in 2 ms, a click beside the name selects in 1 ms, and a double-click on the name opens the
sheet. Only a single click on an added one's name still waits for a possible second one before it selects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd − in its strip

After 8e1b851 an added one waited ~350 ms after a click on its name before it was selected (the name's double-click
gesture held the click), and a double-click changed it only when it landed on the name itself. The list is now the
system's (a List with selection, a table underneath): a click selects an added one at once, a double-click anywhere
on its row or its right-click menu's Edit… changes it, and Remove takes it away; the table tells a double-click from a
click without holding either, and no gesture lies over the checkboxes. + and − sit in a strip along the box's bottom,
as in the mock-up and System Settings' lists, instead of two buttons stuck together under it, and the list is tall
enough for about 15 rows before it scrolls.

A test instance can't time the table's clicks: the debug driver's clicks don't reach a table in a window that isn't
in front. t_openin passed in light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Settings › Open In fits a small screen: the list is as tall as the screen leaves room for (some 450 pt go to the
  rest of the window), so the window doesn't run past the bottom of a 1280×800 display; the list scrolls there.
- Delete removes the added one selected, as in other lists, and a built-in one's right-click menu has Leave Out of /
  Show in the Open Menus (not an empty menu).
- The + sheet takes a link only when it makes a URL with a place in it (a space in it, for one, didn't, and the item
  did nothing).
- {folder}, {file}, {line} and {prompt} are replaced in one pass: a folder named "{file}" no longer has its name
  replaced too.
- An added app is off in a file's menus when the file is neither on disk nor a commit's (it had nothing to open).
- The hint under Terminal says Claude Code's own link picks its terminal itself (it does: its handler is claude).
- The link handler cache keeps "no app" too (assigning nil to it forgot the scheme), comments no longer say Settings
  › General or Claude Code where they mean Open In and the agents, and MenuAction's `visible`, unused since the
  agents' submenu replaced the two Claude Code items, goes.

The checks for every area the branch touches (53) passed, then t_openin (light and dark) and t_quickopen again on
this; the Release build compiles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able values

A row's checkbox passed the row's stored setter (a non-Sendable function value) to Binding, which now takes
@sendable closures: "converting non-Sendable function value … may introduce data races". The pane builds the binding
itself from the row's id and a Bool, and the row takes it as a @binding.

Every Swift file the branch changed, compiled again in Debug and Release, gives no warning now; t_openin passed in
light and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T05:06:52.488491Z c66a2b9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 790e68ab37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread Kaern/Views/Menus/ContextMenus.swift Outdated
Comment on lines +501 to +502
var opening = r.fileOpening(path)
if opening.version?.commit != commit { opening = FileOpening(path: path, version: (commit, path)) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the parent version when opening a deleted commit file

When right-clicking a file deleted by the selected commit, ReviewFile.opening correctly points to the parent commit containing its last contents. This condition replaces that opening because the parent differs from commit, making it reference a nonexistent blob in the deletion commit instead. Consequently, both “Open Version at…” and the normal Open action when the file is absent on disk fail with “Couldn’t read…”, even though the Review header can open the same file successfully. Preserve the existing opening when it belongs to the displayed commit’s diff, including its parent-version fallback for deletions.

Useful? React with 👍 / 👎.

Comment thread Kaern/App/OpenAgents.swift Outdated
"prompt": place.path.map(OpenIn.mention) ?? ""]
var text = substitute(template, values.mapValues { $0.addingPercentEncoding(withAllowedCharacters: .linkValue) ?? "" })
if let mark = text.firstIndex(of: "?") {
let items = text[text.index(after: mark)...].split(separator: "&").filter { !$0.isEmpty && !$0.hasSuffix("=") }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve nonempty query values that end with an equals sign

For a custom link containing a query value with trailing = characters, such as a padded Base64 token, this filter removes the entire parameter rather than just empty values. For example, myagent://new?token=YWJjZA==&folder={folder} becomes myagent://new?folder=/repo, silently discarding the token and potentially preventing the destination from opening the requested session. Check whether the value after the first = is empty instead of testing whether the whole query item ends with =.

Useful? React with 👍 / 👎.

progresshans and others added 2 commits November 30, 2026 13:31
…its right-click menu

The right-click menu of a commit's file (the commit's details, Review's chips and headers) used Review's way of
opening it only when Review's version was the commit's own. A file the commit deleted has none there: Review opens it
at the parent. So the menu fell back to the commit's version, which has no such file, and Open Version at… and Open
in… (with the file gone from disk too) ended in "Couldn't read … at <commit>", while Review's ▾ opened it. Now which
commit Review shows decides (the selection, or a compare's target); while Review shows something else, a file the
selected commit deleted (its details say so) opens at the parent.

Blame at… in the same menu blamed the file at the commit, where it isn't, and showed an empty blame (also before this
branch). It now blames the version the menu opens: Blame at <parent>.

Codex's review of PR 9 found the first. t_openin now deletes a file in a commit and checks the menu's Open Version
at…, Open in… and Blame at…, with Review on that commit and on a compare with the working copy; it passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nding in "=" too

An added link dropped query items by looking at the filled-in text: every item ending in "=" went. So
myagent://new?token=YWJjZA==&folder={folder} opened as myagent://new?folder=… (the token's Base64 padding ends in
"="), and an item the link leaves empty itself (mode=) went too. Now each item is decided on the link as written: it
goes only when its value was nothing but {folder}, {file}, {line} or {prompt} and they came out empty (q={prompt}
without a prompt). Splitting the link as written also means a filled-in value can't split an item, though Kaern
percent-encodes & and = in those anyway. Kaern's own links (Claude Code, Codex) come out as before.

Codex's review of PR 9 found it. t_openin's added link now writes token=YWJjZA== and mode=, and both stay in a
repository's and a file's menus. It passed in light and dark; so did the checks of the areas the two fixes touch
(menus, Open, explore: 9) and the function alone on 12 links, a file name with & and = among them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@progresshans
progresshans merged commit 9c75305 into develop Nov 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant